<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body> 
    <script>
    function changeBackgroundColor() {
    var randomNumber = Math.floor(Math.random() * 16777215).toString(16);
    while (randomNumber.length < 6) {
        randomNumber = '0' + randomNumber;
    }
    var randomColor = '#' + randomNumber;
    document.body.style.backgroundColor = randomColor;
}
document.addEventListener('keydown', function(event) {
    if (event.key === 'f') {
        changeBackgroundColor();
    }
});
</script>
</body>
</html>